<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户修改--这里位置放错了</title>
<meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
<meta name="description"
	content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
<link rel="shortcut icon" href="favicon.ico">
<link href="/hmp/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="/hmp/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="/hmp/css/plugins/bootstrap-table/bootstrap-table.min.css"
	rel="stylesheet">
<link href="/hmp/css/animate.css" rel="stylesheet">
<link href="/hmp/css/style.css?v=4.1.0" rel="stylesheet">
<link href="/hmp/layui/layui/css/layui.css" rel="stylesheet">
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="ibox float-e-margins">
	<!-- 用户添加弹窗  -->
	<div id="addShowDlg">
		<div id="chb-center">
			<!-- 使用layui的表单 -->
			<form class="layui-form layui-form-pane" action="">
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">
						<input id="id" name="id" class="hidden" value="${user.id}"> 
						<input type="text" name="username" id="username" 
							 placeholder="${user.username}" autocomplete="off"
							class="layui-input">
					</div>
				</div>
				 

				<div class="layui-form-item">
					<label class="layui-form-label">邮箱</label>
					<div class="layui-input-block">
						<input type="text" name="email"   
							placeholder="${user.email}" autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">电话</label>
					<div class="layui-input-block">
						<input type="text" name="phone" placeholder="${user.phone}"  
							autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">角色分配</label>
					<div class="layui-input-block">
						<input id="deptId" name="deptId" class="hidden"> <input
							id="deptName" name="deptName" class="layui-input" type="text"  value="${user.roles}"    
							style="cursor: pointer;" readonly="readonly" placeholder="请分配角色">
					</div>
				</div>

				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="chb-update-form">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
		</div>
	</div>
	</div>
</body>

<!-- 全局js -->
<script src="/hmp/js/jquery.min.js?v=2.1.4"></script>
<script src="/hmp/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="/hmp/js/content.js?v=1.0.0"></script>
<script src="/hmp/layui/layui/layui.js"></script>
<script type="text/javascript">
	layui.use(['form','layer'], function(){
		  var   form = layui.form,
	  		    layer=layui.layer;
		  //from  监听提交    这里会表单重复提交的问题  后续处理 
		  form.on('submit(chb-update-form)', function(data){
	 		$.post("/user/update",data.field,function(result){
	 			if(result.code==200)
	 			{
	 				layer.msg("修改成功", {icon: 6}); 
	 				parent.refreshUserListTable();
	 				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
					parent.layer.close(index);
	 			}else
	 			{
	 				layer.alert(result.msg, {icon: 2});
	 			}
	 			
	 		});
	 		return false;
		  });
		  
		  <!--*****用户授权框  iframe ********-->
			$("#deptName").click(function(){
				layer.open({
					type : 2,
					title : '角色授权',
					maxmin : true,
					shadeClose : false, // 点击遮罩关闭层
					area : [ '300px', '450px' ],
					content : "/role/treeView"
				});
			});
			
	});
	
	//给角色 赋值 用的 
	function loadDept(deptId,deptName){
		$("#deptId").val(deptId);
		$("#deptName").val(deptName);
	}
</script>
</html>
